--创建数据库
CREATE DATABASE epm
--创建数据库用户
CREATE USER 'baseUser'@'%' IDENTIFIED BY 'baseUser';
--授权
GRANT SELECT,INSERT,UPDATE,DELETE,CREATE,ALTER,DROP on epm.* to 'baseUser'@'%';
--默认用户
INSERT INTO bp_SecurityUser (userId,username,password,enabled,fullname,createTime) VALUES (1,'admin','admin',1,'系统管理员',null);
--默认角色
INSERT INTO bp_SecurityRole (id,rolename,displayName,description,roleType) VALUES (1,'ROLE_BASIC','系统角色','系统角色，不能删除，不能编辑','SYSTEM');
INSERT INTO bp_SecurityRole (id,rolename,displayName,description,roleType) VALUES (2,'ROLE_ADMIN','系统管理员','系统管理员','SYSTEM');
--角色对应关系
INSERT INTO bp_UserRole(id,comments,userId,roleId) VALUES (1,null,1,1);
INSERT INTO bp_UserRole(id,comments,userId,roleId) VALUES (2,null,1,2);


--配置项


set IDENTITY_INSERT "epm"."dbo"."bp_CommonKey" on
INSERT INTO "epm"."dbo"."bp_CommonKey" (id,keyValue,keyType,typeDescription,checkEnable,indexNumber,enabled,freeItem1,shortCommonKeyValue,parentId) VALUES (1,'自然灾害事件','srRangeBigType','',1,null,1,'','',null);
INSERT INTO "epm"."dbo"."bp_CommonKey" (id,keyValue,keyType,typeDescription,checkEnable,indexNumber,enabled,freeItem1,shortCommonKeyValue,parentId) VALUES (2,'安全生产事故','srRangeBigType','',1,null,1,'','',null);
INSERT INTO "epm"."dbo"."bp_CommonKey" (id,keyValue,keyType,typeDescription,checkEnable,indexNumber,enabled,freeItem1,shortCommonKeyValue,parentId) VALUES (3,'公共卫生事件','srRangeBigType','',1,null,1,'','',null);
INSERT INTO "epm"."dbo"."bp_CommonKey" (id,keyValue,keyType,typeDescription,checkEnable,indexNumber,enabled,freeItem1,shortCommonKeyValue,parentId) VALUES (4,'社会安全事件','srRangeBigType','',1,null,1,'','',null);
INSERT INTO "epm"."dbo"."bp_CommonKey" (id,keyValue,keyType,typeDescription,checkEnable,indexNumber,enabled,freeItem1,shortCommonKeyValue,parentId) VALUES (5,'台风','srRangeBigType','',1,null,1,'','',1);
INSERT INTO "epm"."dbo"."bp_CommonKey" (id,keyValue,keyType,typeDescription,checkEnable,indexNumber,enabled,freeItem1,shortCommonKeyValue,parentId) VALUES (6,'地震','srRangeBigType','',1,null,1,'','',1);
INSERT INTO "epm"."dbo"."bp_CommonKey" (id,keyValue,keyType,typeDescription,checkEnable,indexNumber,enabled,freeItem1,shortCommonKeyValue,parentId) VALUES (7,'总体预案','schnarioType','',1,null,1,'','',null);
INSERT INTO "epm"."dbo"."bp_CommonKey" (id,keyValue,keyType,typeDescription,checkEnable,indexNumber,enabled,freeItem1,shortCommonKeyValue,parentId) VALUES (8,'专项预案','schnarioType','',1,null,1,'','',null);
INSERT INTO "epm"."dbo"."bp_CommonKey" (id,keyValue,keyType,typeDescription,checkEnable,indexNumber,enabled,freeItem1,shortCommonKeyValue,parentId) VALUES (9,'现场处置方案','schnarioType','',1,null,1,'','',null);
INSERT INTO "epm"."dbo"."bp_CommonKey" (id,keyValue,keyType,typeDescription,checkEnable,indexNumber,enabled,freeItem1,shortCommonKeyValue,parentId) VALUES (10,'一级','eventLevel','',1,null,1,'','',null);
INSERT INTO "epm"."dbo"."bp_CommonKey" (id,keyValue,keyType,typeDescription,checkEnable,indexNumber,enabled,freeItem1,shortCommonKeyValue,parentId) VALUES (11,'二级','eventLevel','',1,null,1,'','',null);
INSERT INTO "epm"."dbo"."bp_CommonKey" (id,keyValue,keyType,typeDescription,checkEnable,indexNumber,enabled,freeItem1,shortCommonKeyValue,parentId) VALUES (12,'三级','eventLevel','',1,null,1,'','',null);
INSERT INTO "epm"."dbo"."bp_CommonKey" (id,keyValue,keyType,typeDescription,checkEnable,indexNumber,enabled,freeItem1,shortCommonKeyValue,parentId) VALUES (13,'四级','eventLevel','',1,null,1,'','',null);
INSERT INTO "epm"."dbo"."bp_CommonKey" (id,keyValue,keyType,typeDescription,checkEnable,indexNumber,enabled,freeItem1,shortCommonKeyValue,parentId) VALUES (14,'接报','stageInfoState','',1,null,1,'','',null);
INSERT INTO "epm"."dbo"."bp_CommonKey" (id,keyValue,keyType,typeDescription,checkEnable,indexNumber,enabled,freeItem1,shortCommonKeyValue,parentId) VALUES (15,'启动','stageInfoState','',1,null,1,'','',null);
INSERT INTO "epm"."dbo"."bp_CommonKey" (id,keyValue,keyType,typeDescription,checkEnable,indexNumber,enabled,freeItem1,shortCommonKeyValue,parentId) VALUES (16,'响应','stageInfoState','',1,null,1,'','',null);
INSERT INTO "epm"."dbo"."bp_CommonKey" (id,keyValue,keyType,typeDescription,checkEnable,indexNumber,enabled,freeItem1,shortCommonKeyValue,parentId) VALUES (17,'结束','stageInfoState','',1,null,1,'','',null);
INSERT INTO "epm"."dbo"."bp_CommonKey" (id,keyValue,keyType,typeDescription,checkEnable,indexNumber,enabled,freeItem1,shortCommonKeyValue,parentId) VALUES (18,'归档','stageInfoState','',1,null,1,'','',null);
INSERT INTO "epm"."dbo"."bp_CommonKey" (id,keyValue,keyType,typeDescription,checkEnable,indexNumber,enabled,freeItem1,shortCommonKeyValue,parentId) VALUES (19,'应急启动','stage','',1,null,1,'','',null);
INSERT INTO "epm"."dbo"."bp_CommonKey" (id,keyValue,keyType,typeDescription,checkEnable,indexNumber,enabled,freeItem1,shortCommonKeyValue,parentId) VALUES (20,'应急响应与控制','stage','',1,null,1,'','',null);
INSERT INTO "epm"."dbo"."bp_CommonKey" (id,keyValue,keyType,typeDescription,checkEnable,indexNumber,enabled,freeItem1,shortCommonKeyValue,parentId) VALUES (21,'应急解除与恢复','stage','',1,null,1,'','',null);
INSERT INTO "epm"."dbo"."bp_CommonKey" (id,keyValue,keyType,typeDescription,checkEnable,indexNumber,enabled,freeItem1,shortCommonKeyValue,parentId) VALUES (22,'汇报/请示/通报','stage','',1,null,1,'','',19);
INSERT INTO "epm"."dbo"."bp_CommonKey" (id,keyValue,keyType,typeDescription,checkEnable,indexNumber,enabled,freeItem1,shortCommonKeyValue,parentId) VALUES (23,'人员就位情况','stage','',1,null,1,'','',19);
INSERT INTO "epm"."dbo"."bp_CommonKey" (id,keyValue,keyType,typeDescription,checkEnable,indexNumber,enabled,freeItem1,shortCommonKeyValue,parentId) VALUES (24,'资源调配情况','stage','',1,null,1,'','',19);
INSERT INTO "epm"."dbo"."bp_CommonKey" (id,keyValue,keyType,typeDescription,checkEnable,indexNumber,enabled,freeItem1,shortCommonKeyValue,parentId) VALUES (25,'人员救助情况','stage','',1,null,1,'','',20);
INSERT INTO "epm"."dbo"."bp_CommonKey" (id,keyValue,keyType,typeDescription,checkEnable,indexNumber,enabled,freeItem1,shortCommonKeyValue,parentId) VALUES (26,'工程抢险','stage','',1,null,1,'','',20);
INSERT INTO "epm"."dbo"."bp_CommonKey" (id,keyValue,keyType,typeDescription,checkEnable,indexNumber,enabled,freeItem1,shortCommonKeyValue,parentId) VALUES (27,'现场检测','stage','',1,null,1,'','',20);
INSERT INTO "epm"."dbo"."bp_CommonKey" (id,keyValue,keyType,typeDescription,checkEnable,indexNumber,enabled,freeItem1,shortCommonKeyValue,parentId) VALUES (28,'环境保护','stage','',1,null,1,'','',20);
INSERT INTO "epm"."dbo"."bp_CommonKey" (id,keyValue,keyType,typeDescription,checkEnable,indexNumber,enabled,freeItem1,shortCommonKeyValue,parentId) VALUES (29,'警戒与隔离','stage','',1,null,1,'','',20);
INSERT INTO "epm"."dbo"."bp_CommonKey" (id,keyValue,keyType,typeDescription,checkEnable,indexNumber,enabled,freeItem1,shortCommonKeyValue,parentId) VALUES (30,'专家支持','stage','',1,null,1,'','',20);
INSERT INTO "epm"."dbo"."bp_CommonKey" (id,keyValue,keyType,typeDescription,checkEnable,indexNumber,enabled,freeItem1,shortCommonKeyValue,parentId) VALUES (31,'人群疏散','stage','',1,null,1,'','',20);
INSERT INTO "epm"."dbo"."bp_CommonKey" (id,keyValue,keyType,typeDescription,checkEnable,indexNumber,enabled,freeItem1,shortCommonKeyValue,parentId) VALUES (32,'政府联络','stage','',1,null,1,'','',20);
INSERT INTO "epm"."dbo"."bp_CommonKey" (id,keyValue,keyType,typeDescription,checkEnable,indexNumber,enabled,freeItem1,shortCommonKeyValue,parentId) VALUES (33,'现场清理','stage','',1,null,1,'','',21);
INSERT INTO "epm"."dbo"."bp_CommonKey" (id,keyValue,keyType,typeDescription,checkEnable,indexNumber,enabled,freeItem1,shortCommonKeyValue,parentId) VALUES (34,'解除警戒','stage','',1,null,1,'','',21);
INSERT INTO "epm"."dbo"."bp_CommonKey" (id,keyValue,keyType,typeDescription,checkEnable,indexNumber,enabled,freeItem1,shortCommonKeyValue,parentId) VALUES (35,'善后处理','stage','',1,null,1,'','',21);
INSERT INTO "epm"."dbo"."bp_CommonKey" (id,keyValue,keyType,typeDescription,checkEnable,indexNumber,enabled,freeItem1,shortCommonKeyValue,parentId) VALUES (36,'调查取证','stage','',1,null,1,'','',21);
INSERT INTO "epm"."dbo"."bp_CommonKey" (id,keyValue,keyType,typeDescription,checkEnable,indexNumber,enabled,freeItem1,shortCommonKeyValue,parentId) VALUES (37,'应急结束与评估','stage','',1,null,1,'','',null);
INSERT INTO "epm"."dbo"."bp_CommonKey" (id,keyValue,keyType,typeDescription,checkEnable,indexNumber,enabled,freeItem1,shortCommonKeyValue,parentId) VALUES (38,'应急总结评价','stage','',1,null,1,'','',37);
INSERT INTO "epm"."dbo"."bp_CommonKey" (id,keyValue,keyType,typeDescription,checkEnable,indexNumber,enabled,freeItem1,shortCommonKeyValue,parentId) VALUES (39,'火灾与爆炸','srRangeBigType','',1,null,1,'','',2);
INSERT INTO "epm"."dbo"."bp_CommonKey" (id,keyValue,keyType,typeDescription,checkEnable,indexNumber,enabled,freeItem1,shortCommonKeyValue,parentId) VALUES (40,'建筑物坍塌','srRangeBigType','',1,null,1,'','',2);
INSERT INTO "epm"."dbo"."bp_CommonKey" (id,keyValue,keyType,typeDescription,checkEnable,indexNumber,enabled,freeItem1,shortCommonKeyValue,parentId) VALUES (41,'重大传染病疫情','srRangeBigType','',1,null,1,'','',3);
INSERT INTO "epm"."dbo"."bp_CommonKey" (id,keyValue,keyType,typeDescription,checkEnable,indexNumber,enabled,freeItem1,shortCommonKeyValue,parentId) VALUES (42,'食物和职业中毒','srRangeBigType','',1,null,1,'','',3);
INSERT INTO "epm"."dbo"."bp_CommonKey" (id,keyValue,keyType,typeDescription,checkEnable,indexNumber,enabled,freeItem1,shortCommonKeyValue,parentId) VALUES (43,'战争','srRangeBigType','',1,null,1,'','',4);
INSERT INTO "epm"."dbo"."bp_CommonKey" (id,keyValue,keyType,typeDescription,checkEnable,indexNumber,enabled,freeItem1,shortCommonKeyValue,parentId) VALUES (44,'恐怖暴力事件','srRangeBigType','',1,null,1,'','',4);
INSERT INTO "epm"."dbo"."bp_CommonKey" (id,keyValue,keyType,typeDescription,checkEnable,indexNumber,enabled,freeItem1,shortCommonKeyValue,parentId) VALUES (45,'刑事案件','srRangeBigType','',1,null,1,'','',4);
INSERT INTO "epm"."dbo"."bp_CommonKey" (id,keyValue,keyType,typeDescription,checkEnable,indexNumber,enabled,freeItem1,shortCommonKeyValue,parentId) VALUES (46,'海啸','srRangeBigType','',1,null,1,'','',1);
INSERT INTO "epm"."dbo"."bp_CommonKey" (id,keyValue,keyType,typeDescription,checkEnable,indexNumber,enabled,freeItem1,shortCommonKeyValue,parentId) VALUES (47,'雪灾','srRangeBigType','',1,null,1,'','',1);
INSERT INTO "epm"."dbo"."bp_CommonKey" (id,keyValue,keyType,typeDescription,checkEnable,indexNumber,enabled,freeItem1,shortCommonKeyValue,parentId) VALUES (48,'环境污染事故','srRangeBigType',null,1,4,1,null,null,2);
INSERT INTO "epm"."dbo"."bp_CommonKey" (id,keyValue,keyType,typeDescription,checkEnable,indexNumber,enabled,freeItem1,shortCommonKeyValue,parentId) VALUES (49,'危险化学品事故','srRangeBigType',null,1,4,1,null,null,2);
INSERT INTO "epm"."dbo"."bp_CommonKey" (id,keyValue,keyType,typeDescription,checkEnable,indexNumber,enabled,freeItem1,shortCommonKeyValue,parentId) VALUES (50,'重特大交通事故','srRangeBigType',null,1,5,1,null,null,2);
INSERT INTO "epm"."dbo"."bp_CommonKey" (id,keyValue,keyType,typeDescription,checkEnable,indexNumber,enabled,freeItem1,shortCommonKeyValue,parentId) VALUES (51,'重特大事件','srRangeBigType',null,1,6,1,null,null,2);
INSERT INTO "epm"."dbo"."bp_CommonKey" (id,keyValue,keyType,typeDescription,checkEnable,indexNumber,enabled,freeItem1,shortCommonKeyValue,parentId) VALUES (52,'人员伤害','srRangeBigType',null,1,7,1,null,null,2);
INSERT INTO "epm"."dbo"."bp_CommonKey" (id,keyValue,keyType,typeDescription,checkEnable,indexNumber,enabled,freeItem1,shortCommonKeyValue,parentId) VALUES (53,'重大疫情','srRangeBigType',null,1,3,1,null,null,3);
INSERT INTO "epm"."dbo"."bp_CommonKey" (id,keyValue,keyType,typeDescription,checkEnable,indexNumber,enabled,freeItem1,shortCommonKeyValue,parentId) VALUES (54,'多人食物中毒事故','srRangeBigType',null,1,4,1,null,null,3);
INSERT INTO "epm"."dbo"."bp_CommonKey" (id,keyValue,keyType,typeDescription,checkEnable,indexNumber,enabled,freeItem1,shortCommonKeyValue,parentId) VALUES (55,'公众聚集场所重大事故','srRangeBigType',null,1,4,1,null,null,4);
INSERT INTO "epm"."dbo"."bp_CommonKey" (id,keyValue,keyType,typeDescription,checkEnable,indexNumber,enabled,freeItem1,shortCommonKeyValue,parentId) VALUES (56,'恐怖事件或蓄意破坏','srRangeBigType',null,1,5,1,null,null,4);
INSERT INTO "epm"."dbo"."bp_CommonKey" (id,keyValue,keyType,typeDescription,checkEnable,indexNumber,enabled,freeItem1,shortCommonKeyValue,parentId) VALUES (57,'不可预见社会安全','srRangeBigType',null,1,6,1,null,null,4);
INSERT INTO "epm"."dbo"."bp_CommonKey" (id,keyValue,keyType,typeDescription,checkEnable,indexNumber,enabled,freeItem1,shortCommonKeyValue,parentId) VALUES (58,'起重机械故障','srRangeBigType',null,1,8,1,null,null,2);
INSERT INTO "epm"."dbo"."bp_CommonKey" (id,keyValue,keyType,typeDescription,checkEnable,indexNumber,enabled,freeItem1,shortCommonKeyValue,parentId) VALUES (59,'物料喷溅','srRangeBigType',null,1,9,1,null,null,2);
INSERT INTO "epm"."dbo"."bp_CommonKey" (id,keyValue,keyType,typeDescription,checkEnable,indexNumber,enabled,freeItem1,shortCommonKeyValue,parentId) VALUES (60,'水灾','srRangeBigType',null,1,5,1,null,null,1);
INSERT INTO "epm"."dbo"."bp_CommonKey" (id,keyValue,keyType,typeDescription,checkEnable,indexNumber,enabled,freeItem1,shortCommonKeyValue,parentId) VALUES (61,'总体预案','srRangeBigType',null,1,null,1,null,null,null);
INSERT INTO "epm"."dbo"."bp_CommonKey" (id,keyValue,keyType,typeDescription,checkEnable,indexNumber,enabled,freeItem1,shortCommonKeyValue,parentId) VALUES (62,'总体预案','srRangeBigType',null,1,null,1,null,null,61);

set IDENTITY_INSERT "epm"."dbo"."bp_CommonKey" off

set IDENTITY_INSERT "epm"."dbo"."bp_CommonKeyType" on
INSERT INTO "epm"."dbo"."bp_CommonKeyType" (id,typeCode,typeName,module,isLay) VALUES (1,'srRangeBigType','预案适用范围','预案管理',1);
INSERT INTO "epm"."dbo"."bp_CommonKeyType" (id,typeCode,typeName,module,isLay) VALUES (2,'schnarioType','预案类型','预案管理',0);
INSERT INTO "epm"."dbo"."bp_CommonKeyType" (id,typeCode,typeName,module,isLay) VALUES (3,'eventLevel','事件级别','事件管理',0);
INSERT INTO "epm"."dbo"."bp_CommonKeyType" (id,typeCode,typeName,module,isLay) VALUES (4,'stage','应急阶段','事件管理',1);
INSERT INTO "epm"."dbo"."bp_CommonKeyType" (id,typeCode,typeName,module,isLay) VALUES (5,'stageInfoState','应急事件状态','事件管理',0);
set IDENTITY_INSERT "epm"."dbo"."bp_CommonKeyType" off